package com.bbc.starter.config;

import com.bbc.starter.prop.IpStarterProperties;
import com.bbc.starter.service.IpStarterService;
import com.bbc.starter.service.impl.IpStarterServiceImpl;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;

@Configuration
@AutoConfigureBefore(SpringConfig.class)
public class IPAutoConfiguration {

    @Bean
    @DependsOn("ipStarterProperties")
    public IpStarterService ipStarterService(){
        return new IpStarterServiceImpl();
    }

    @Bean
    @ConfigurationProperties("tools.ip")
    public IpStarterProperties ipStarterProperties(){
        return new IpStarterProperties();
    }

}
